<%@ page import="com.yyyzzz.DAO.impl.teacherDaoimpl" %>
<%@ page import="com.yyyzzz.bean.Teacher" %>
<%@ page import="java.util.List" %>
<%@ page import="com.yyyzzz.DAO.impl.teacherDaoimpl" %>
<%@ page import="com.yyyzzz.DAO.teacherDao" %>
<%@ page import="com.mysql.cj.Session" %>
<%@ page import="com.yyyzzz.bean.Teacher" %>
<%@ page import="java.sql.SQLException" %>
<%@ page import="com.yyyzzz.service.impl.teacherServiceImpl" %>
<%@ page import="com.yyyzzz.bean.Course" %><%--
  Created by IntelliJ IDEA.
  User: ZY
  Date: 2021/12/9
  Time: 17:41
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>教师选项</title>
    <link rel="stylesheet" href="studentMain/studentMain.css" type="text/css">

</head>
<body>
<header>
    <h1 style="color:red;"> ${error1}</h1>
    <a href="#" class="logo">学生选课系统</a>
    <ul>
        <li>
            <a href="teacherself.jsp">查看个人信息</a><br>

        </li>
        <li>
            <%
                teacherDaoimpl teacherDaoimpl = new teacherDaoimpl ();
                int id = (int) session.getAttribute ("id");
                Teacher teacher = teacherDaoimpl.getTeacherById (id);
                String name = teacher.getTeachername ();
            %>
            <a href="select?name=<%=name%>">查看课程信息</a>
        </li>
        <li><a href="teachermodify.jsp">修改个人信息</a><br>
        </li>
    </ul>
</header>
<section>
    <img src="Login/stars.png" id="stars">
    <img src="Login/moon.png" id="moon">
    <img src="Login/mountainsbehind.png" id="mountains_behind">
    <img src="Login/mountainsfront.png" id="mountains_front">
    <div class="main">
        <div class="info">

            <img src="Login/jingfu.jpg" class="jinfu">

            <table>
                <tr>
                    <td style="font-size: 1.8em;font-family: 华文楷体">个人信息</td>
                </tr>
                <%
                    teacherDaoimpl teacherDao = new teacherDaoimpl ();
                    int i = (int) session.getAttribute ("id");
                    Teacher teacher1 = teacherDao.getTeacherById (i);
                %>
                <tr>
                    <td>姓名</td>
                    <td><%=teacher.getTeachername()%></td>
                    </td>
                </tr>
                <tr>
                    <td>教师号</td>
                    <td><%=teacher.getTeacherNo()%></td>
                    </td>
                </tr>
                <tr>
                    <td>所授课程</td>
                    <td><%=teacher.getTeacherjob()%></td>
                    </td>
                </tr>
                <tr>
                    <td>性别</td>
                    <td><%=teacher.getSex()%></td>
                    </td>
                </tr>
            </table>
        </div>
        <div id="sec" class="sec">
            <div>
                <table cellspacing="0" class="tab">
                    <caption>课程信息</caption>

                    <tr>
                        <td align="center">
                            课程号
                        </td>
                        <td align="center">
                            课程名
                        </td>

                        <td align="center">
                            任课教师
                        </td>
                        <td align="center">
                            教室
                        </td>
                        <td align="center">
                            学分
                        </td>
                        <td align="center" colspan="2">
                            操作
                        </td>

                    </tr>
                    <%
                        String name1 = String.valueOf (request.getAttribute ("name"));
                        System.out.println (name);
                        teacherServiceImpl teacherService = new teacherServiceImpl ();
                        List<Course> list = teacherService.selectCourseTeacher (name);
                        for (Course course : list
                        ) {
                    %>
                    <%-- <c:forEach items="${courseList1 }" var="course">--%>

                    <tr>
                        <td align="center"><%=course.getCourseId ()%>
                        </td>
                        <td align="center"><%=course.getCourseName()%>
                        </td>
                        <td align="center"><%=course.getCourseTeacher()%>
                        </td>
                        <td align="center"><%=course.getClassroom()%>
                        </td>
                        <td align="center"><%=course.getCredit()%>
                        </td>
                        <td align="center" id="cao1">
                            <a style="color: #ffffff;"
                               href="chooseCourseServlet?courseId=<%=course.getCourseId()%>&courseName=<%=course.getCourseName()%>&courseTeacher=<%=course.getCourseTeacher()%>&classRoom=<%=course.getClassroom()%>&credit=<%=course.getCredit()%>">选择</a>
                        </td>
                        <%--<td id="cao1" align="center">
                            <a style="color: #ff0000;" href="delectCourseServlet?courseid=<%=course.getCourseId()%>"
                               onClick="if(!confirm('您确定删除该课程吗？'))
return false;else return true;">退选</a>
                        </td>--%>
                        <%
                            }

                        %>
                    </tr>
                    <%--</c:forEach>--%>
                </table>
            </div>
        </div>
    </div>
</section>
<script>
    let stars = document.getElementById('stars');
    let moom = document.getElementById('moon');
    let mountains_behind = document.getElementById('mountains_behind');
    let mountains_front = document.getElementById('mountains_front');
    let text = document.getElementById('text');
    let btn = document.getElementById('btn');
    let header = document.querySelector('header');
    window.addEventListener('scroll', function () {
        let value = window.scrollY;
        stars.style.left = value * 0.25 + 'px';
        moom.style.top = value * 1.05 + 'px';
        mountains_behind.style.top = value * 0.5 + 'px';
        mountains_front.style.top = value * 0 + 'px';
        text.style.marginRight = value * 4 + 'px';
        text.style.marginTop = value * 1.5 + 'px';
        btn.style.marginRight = value * 4 + 'px';
        header.style.top = value * 0.5 + 'px';

    })

    function bc() {
        document.getElementById("search").style.width = '600px';
    }

    function lk() {
        document.getElementById("search").style.width = '200px';
    }
</script>
<%--<a href="TeacherSchedul.jsp">查看课程表</a><br>--%>
<%--<a href="teacherself.jsp">查看个人信息</a><br>
<a href="teachermodify.jsp">修改个人信息</a><br>
<%
    teacherDaoimpl teacherDaoimpl = new teacherDaoimpl ();
    int id = (int) session.getAttribute ("id");
    Teacher teacher = teacherDaoimpl.getTeacherById (id);
    String name = teacher.getTeachername ();
%>
<a href="select?name=<%=name%>">查看课程信息</a>--%>
</body>
</html>
